﻿using FANUC.BLL;
using FANUC.DTO;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Description;

namespace FANUC.Controllers
{
    public class SealUnitMeasurementHistoryController : ApiController
    {
        private TraceService service = new TraceService();

        /// <summary>
        /// Get 
        /// </summary>
        /// <param name="id">Robot ID</param>
        /// <returns></returns>
        [ResponseType(typeof(SealMeasurementDataForOnePartOnePassDtoOut))]
        public IHttpActionResult Get(int id)
        {
            var data = service.GetSealMeasurementDataForOnePartOnePassByRobotId(id);
            return Ok(data);
        }


        /// <summary>
        /// Query one part, one pass_no measurement data
        /// </summary>
        /// <param name="Part_Serial">Part_Serial</param>
        /// <param name="Pass_No">Pass_No</param>
        /// <returns></returns>
        [ResponseType(typeof(SealMeasurementDataForOnePartOnePassDtoOut))]
        public IHttpActionResult Get(string Part_Serial, int Pass_No)
        {
            return Ok(service.GetSealMeasurementDataForOnePartOnePassByPartSerialAndPassNo(Part_Serial, Pass_No));
        }

        // POST api/values
        public void Post([FromBody]string id)
        {
        }
        [ApiExplorerSettings(IgnoreApi = true)]
        public string Options()
        {
            return null;
        }
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                service.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}
